6900 VLIN 0,39 AT 0: VLIN 0,39 AT 39: HLIN 0,39 AT 0: HLIN 0,39 AT 39
7000 X = 1:Y = INT(13 * RND(1)) +1: COLOR= 4: FOR K = 0 TO 1: FOR L = 0 TO 1: PLOT 3 *X -2 +K,3 *Y -2 +L: NEXT L,K
7100 HX = 3 *X -2:HY = 3 *Y -2
7200 REM PICK SPOT FOR DOOR
7300 WY = INT(13 * RND(1)) +1
7400 COLOR= 0: VLIN 3 *WY -2,3 *WY -1 AT 39
7500 SX = 13:SY = WY
7600 QX = 3 *SX -2:QY = 3 *SY -2
7700 RD = 1: REM SET COLOR FOR DRAGON
7800 GOSUB 12800
7900 IF SX = X AND SY = Y THEN 15700
8000 K = PEEK( -16384): IF K <128 THEN 8000
8100 POKE -16368,0
8200 IF K = 210 THEN 8700: REM CHAR R
8300 IF K = 204 THEN 9700: REM CHAR L
8400 IF K = 213 THEN 10000: REM CHAR U
8500 IF K = 196 THEN 10300: REM CHAR D
8600 GOSUB 12200: GOTO 7800
8700 DX = 1:DY = 0
8800 B = 10:R1 = FN MOD(M(X +13 *(Y -1))): IF R1 THEN 10600
8900 FX = 3 *X -2:FY = 3 *Y -2: FOR I = 1 TO 3
9000 FX = FX +DX:FY = FY +DY
9100 COLOR= 0
9200 FOR K = 0 TO 1: FOR L = 0 TO 1: PLOT HX +K,HY +L: NEXT L,K: COLOR= 4: FOR K = 0 TO 1: FOR L = 0 TO 1: PLOT FX +K,FY +L: NEXT L,K:HX = FX:HY = FY
9300 NEXT I
9400 X = X +DX:Y = Y +DY
9500 IF X = 13 AND Y = WY THEN 12300
9600 GOTO 7800
9700 DX = -1:DY = 0
9800 B = 10:R1 = FN MOD(M(X +13 *(Y -1) -1)): IF R1 THEN 11000
9900 GOTO 8900
10000 DX = 0:DY = -1
10100 IF M(X +13 *(Y -2))/10 < = -1 THEN 11400
10200 GOTO 8900
10300 DX = 0:DY = 1
10400 IF M(X +13 *(Y -1))/10 < = -1 THEN 11800
10500 GOTO 8900
10600 GOSUB 12200
10700 COLOR= 6
10800 VLIN 3 *(Y -1),3 *Y AT 3 *X
10900 GOTO 7800
11000 GOSUB 12200
11100 COLOR= 6
11200 VLIN 3 *(Y -1),3 *Y AT 3 *(X -1)
11300 GOTO 7800
11400 GOSUB 12200
11500 COLOR= 6
11600 HLIN 3 *(X -1),3 *X AT 3 *(Y -1)
11700 GOTO 7800
11800 GOSUB 12200
11900 COLOR= 6
12000 HLIN 3 *(X -1),3 *X AT 3 *Y
12100 GOTO 7800
12200 S = S -1: FOR I = 1 TO 20:A = PEEK( -16336) + PEEK( -16336) + PEEK( -16336) + PEEK( -16336): NEXT I: RETURN
12300 PRINT "YOU WIN"
12400 GOSUB 12200: GOSUB 12200: GOSUB 12200
12500 PRINT "SCORE=";S +3
12600 GOTO 15800
12700 REM COMPUTE MOVE FOR DRAGON
12800 IF X >SX THEN 13200
12900 IF Y >SY THEN 14500
13000 IF X <SX THEN 14900
13100 IF Y <SY THEN 15300
13200 IF SX = 13 THEN 14500
13300 IF T(SX +13 *(SY -1)) >9 THEN 13500
13400 B = 10:R1 = FN MOD(M(SX +13 *(SY -1))): IF R1 THEN 14500
13500 DX = 1:DY = 0
13600 COLOR= 0
13700 RX = 3 *SX -2:RY = 3 *SY -2
13800 FOR I = 1 TO 3:RX = RX +DX:RY = RY +DY
13900 COLOR= 0
14000 FOR K = 0 TO 1: FOR L = 0 TO 1: PLOT QX +K,QY +L: NEXT L,K: COLOR= RD: FOR K = 0 TO 1: FOR L = 0 TO 1: PLOT RX +K,RY +L: NEXT L,K:QX = RX:QY = RY
14100 NEXT I
14200 SX = SX +DX:SY = SY +DY
14300 T(SX +13 *(SY -1)) = T(SX +13 *(SY -1)) +1
14400 RETURN
14500 IF SY = 13 THEN 14900
14600 IF T(SX +13 *(SY -1)) >9 THEN 14800
14700 IF M(SX +13 *(SY -1))/10 < = -1 THEN 14900
14800 DX = 0:DY = 1: GOTO 13600
14900 IF SX = 1 THEN 15300
15000 IF T(SX +13 *(SY -1)) >9 THEN 15200
15100 B = 10:R1 = FN MOD(M(SX +13 *(SY -1) -1)): IF R1 THEN 15300
15200 DX = -1:DY = 0: GOTO 13600
15300 IF SY = 1 THEN 13200
15400 IF T(SX +13 *(SY -1)) >9 THEN 15600
15500 IF M(SX +13 *(SY -1) -13)/10 < = -1 THEN 13200